/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package com.bookshop.customControllers;

import com.bookshop.entity.Type;
import com.bookshop.facade.TypeFacade;
import java.util.ArrayList;
import java.util.List;
import javax.ejb.EJB;
import javax.faces.bean.ManagedBean;
import javax.faces.bean.SessionScoped;

/**
 *
 * @author Caroline
 */
@ManagedBean(name = "myTypeController")
@SessionScoped
public class MyTypeController {
    
    @EJB
    private TypeFacade typeFacade;
    
    private List<Type> types = new ArrayList<Type>();
    private Type type = new Type();

    public List<Type> getTypes() {
        if (this.types.isEmpty()) {
            this.types = typeFacade.findAll();
        }
        return this.types;
    }

    public void setTypes(List<Type> types) {
        this.types = types;
    }

    public Type getType() {
        return type;
    }

    public void setType(Type type) {
        this.type = type;
    }

    /**
     * Creates a new instance of MyTypeController
     */
    public MyTypeController() {
        
    }

}
